package com.pai.gui;
import java.awt.Graphics;
 

import javax.swing.*;

import com.sun.awt.AWTUtilities;
 
public class TranslucentWindow extends JFrame{
    public TranslucentWindow() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //隐藏界面装饰，显示透明界面
        setUndecorated(true);
        //自定义框架外观
        AWTUtilities.setWindowOpaque(this, false);
        //设置外观为Windows默认外观
        try {
			UIManager.setLookAndFeel(
			        UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException e) {
			//自动生成的 catch 块
			e.printStackTrace();
		} catch (InstantiationException e) {
			//自动生成的 catch 块
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			//自动生成的 catch 块
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			//自动生成的 catch 块
			e.printStackTrace();
		}         
        
        //将此框架添加进鼠标监听器于是可以实现拖拽
        FrameListener moveListener = new FrameListener(this);
         
        addMouseListener(moveListener);
        addMouseMotionListener(moveListener);
        
        setVisible(true);
    }
}